package com.qisi.demo;

import com.qisi.driver.JsonAlertJobDriver;
import com.qisi.functions.SourceFunctions;
import com.qisi.pojo.Rule;
import com.qisi.utils.Config;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class SourceDemo {
    public static void main(String[] args) throws Exception {

        // 全局配置
        Configuration config = Config.initApplicationConfig(args, JsonAlertJobDriver.class);

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(2);

        DataStreamSource<Rule> source = env.addSource(SourceFunctions.getCustomMysqlSource(config));

        source.print();

        env.execute("source job");
    }
}
